package com.allenyuan.renderobject;

import com.allenyuan.render.RenderStroke;
import com.allenyuan.render.Renderer;

public class RenderTransformRectangle extends RenderRectangle {
	
	private RenderObject obj;
	
	public static final int NOT_BOUND = -1;
	public static final int BOUND_LEFT = 0;
	public static final int BOUND_RIGHT = 1;
	public static final int BOUND_TOP = 2;
	public static final int BOUND_BOTTOM = 3;
	public static final int BOUND_LEFT_TOP = 4;
	public static final int BOUND_LEFT_BOTTOM = 5;
	public static final int BOUND_RIGHT_TOP = 6;
	public static final int BOUND_RIGHT_BOTTOM = 7;

	public RenderTransformRectangle(RenderObject obj) {
		super(obj.getBound().getPoint(), obj.getBound().getWidth(), obj.getBound().getHeight());
		this.obj = obj;
	}

	public RenderTransformRectangle(RenderPoint point, int width, int height) {
		super(point, width, height);
		// TODO Auto-generated constructor stub
	}
	
	public RenderTransformRectangle() {
		super();
	}
	
	@Override
	public void draw(Renderer r) {
		// TODO Auto-generated method stub
		RenderStroke stroke = r.getStroke();
		r.setStroke(new RenderStroke(true, 1));
		super.draw(r);
		r.setStroke(stroke);
		r.drawCircle(point.getX(), point.getY(), 3);
		r.drawCircle(point.getX() + width, point.getY(), 3);
		r.drawCircle(point.getX(), point.getY() + height, 3);
		r.drawCircle(point.getX() + width, point.getY() + height, 3);
	}

	public RenderObject getObj() {
		return obj;
	}

	public void setObj(RenderObject obj) {
		this.obj = obj;
	}

	public int isBound(RenderPoint point) {
		return NOT_BOUND;
	}
}
